package com.maxlen.order.config;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;

@Configuration
public class MyRabbitTemplateConfig {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    @PostConstruct
    public void initRabbitTemplate() {
//        rabbitTemplate.setConfirmCallback((correlationData, ack, cause) -> {
//            System.out.println("CorrelationData => " + correlationData);
//            System.out.println("ack             => " + ack);
//            System.out.println("cause           => " + cause);
//        });

        rabbitTemplate.setReturnsCallback(returned -> {
            System.out.println(returned);
        });
    }

}
